$(function() {
	var eventId = $('#eventId').text();
	// alert(eventId);
	//alert("cool!!");
	//alert(eventId);
	setTimeout(showDetail,1000);
	

	function showDetail() {
		
		//alert("cool!!");
		
		var timestamp = Date.parse(new Date());
		url = "/ag/zrt/showEventDetail.action?ts="+timestamp;
		data = {
			eventId : eventId
		};

		$.post(url, data, showEventDetail);
	}
	
	function showEventDetail(data) {
		if(data.commander != null)
		$('#commander').text(data.commander);
		if(data.planName != null)
		$('#planName').text(data.planName);
		if(data.eventName != null)
		$('#eventName').text(data.eventName);
		//if(data.implementPlan != null)
		$('#happenedTime').text(data.happenedTime);
		if(data.eventType != null)
		$('#eventType').text(data.eventType);
		if(data.eventLevel != null)
		$('#eventLevel').text(data.eventLevel);
		if(data.teamLeader != null)
		$('#teamLeader').text(data.teamLeader);
		if(data.implementPlan != null)
		$('#implementPlan').text(data.implementPlan);
		if(data.assistDept != null)
		$('#assistDept').text(data.assistDept);
		if(data.viceCommander != null)
		$('#viceCommander').text(data.viceCommander);

		check(data);
	}

	function check(data) {
		if (data.emergency == 1) {
			$('#emergency').attr('checked', true);
		}
		if (data.government == 1) {
			$('#government').attr('checked', true);
		}
		if (data.asianGames == 1) {
			$('#asianGames').attr('checked', true);
		}
		if (data.bureau == 1) {
			$('#bureau').attr('checked', true);
		}
		if (data.release == 1) {
			$('#release').attr('checked', true);
		}

		$('input[type=checkbox]').attr('disabled', true);
	}
});